<?php
namespace Little\Controller;
header("Content-type: text/html; charset=utf-8");
use Think\Controller;

//********************vip************************

class VipsController extends Controller
{
    public function index(){
        //轮播图 news_lun 1 商品 2资讯  3会员卡  4攻略课堂 5线上报名 6题库
        $lun = sels("news_lun", "", "type = 2", "id desc");
        if ($lun) {
            foreach ($lun as $k => $v) {
                $lun[$k]['img'] = IMGS . $v['img'];
            }
        } else {
            $lun = 1;
        }
        //公告
        $gong = sels("news", "id,title", "type = 2", "id desc");
        if (!$gong) {
            $gong = 1;
        }
        //vi说明信息
        $vip_info = sel("vip_intro","content_one,content_two,content_three");
        $vip_info['content_one'] = img_jie('/little_program/store_love', $vip_info['content_one']);
        $vip_info['content_two'] = img_jie('/little_program/store_love', $vip_info['content_two']);
        $vip_info['content_three'] = img_jie('/little_program/store_love', $vip_info['content_three']);
        $vips = sels("vip_type","id,name");
        if($vips){
            foreach ($vips as $k=>$v){
                $list = sels("vips","","vip_type = {$v['id']}");
                if($list){
                    $vips[$k]['info'] = vips($list,$v['name']);
                }else{
                    $vips[$k]['info'] = 1;
                }
            }
        }else{
            $vips = 1;
        }
        echo json_encode(array("lun" => $lun, "gong" => $gong, "info" => $vips,"vip_info"=>$vip_info));
    }
}